package com.itheima.sys.mapper;

import com.itheima.sys.entity.Company;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author itheima
 * @since 2020-12-13
 */
public interface CompanyMapper extends BaseMapper<Company> {

    @Select("SELECT * from company c where c.id in(SELECT u.company_id from company_user u where u.user_id = #{userId} )")
    List<Company> queryUserJoinCompany(@Param("userId") Long userId);
}
